babl: fix fixed to double conversions
authorElle Stone <ellestone@ninedegreesbelow.com>
Sat, 9 Jun 2018 17:18:43 +0000 (19:18 +0200)
committerØyvind Kolås <pippin@gimp.org>
Sat, 9 Jun 2018 17:22:10 +0000 (19:22 +0200)
See issue #18 https://gitlab.gnome.org/GNOME/babl/issues/18

babl/babl-icc.c

index e8393e3385957694722a176c6a4cfcb81f1b7515..973da7f3cf8b1382072d43fbcf560d511e0be1ed 100644 (file)
@@ -165,12 +165,12 @@ static u8f8_t d_to_u8f8 (double value)
 
 static double s15f16_to_d (s15f16_t fix)
 {
-  return fix.integer + fix.fraction / 65535.0;
+  return fix.integer + fix.fraction / 65536.0;
 }
 
 static double u8f8_to_d (u8f8_t fix)
 {
-  return fix.integer + fix.fraction / 255.0;
+  return fix.integer + fix.fraction / 256.0;
 }
 
 static void write_s15f16 (ICC *state, int offset, double value)